//
//  Extension+NSAttributedString.swift
//  STVVeibo
//
//  Created by leergou on 16/7/31.
//  Copyright © 2016年 WhiteHouse. All rights reserved.
//

import UIKit

extension NSAttributedString {
    
    // 便利构造函数
    convenience init(emoticon: STEmoticon, y: CGFloat, lineHeight: CGFloat) {
        // 文本附件
        let attach = STAttachment()
        // 赋值
        attach.emoticon = emoticon
        // 设置image
        attach.image = UIImage.getEmoticonImage(emoticon.path)
        // 记住一定要设置bounds
        attach.bounds = CGRect(x: 0, y: y, width: lineHeight, height: lineHeight)
        //MARK: 这个是怎么写出来的?????
        self.init(attachment:attach)
    }
}
